package com.bhs.sansong.ui.setting;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bhs.sansong.BuildConfig;
import com.bhs.sansong.R;
import com.bhs.sansong.base.BaseActivity;
import com.bhs.sansong.ui.findLogistics.CheckAttachmentActivity;
import com.bhs.sansong.utils.MyUtils;
import com.bhs.sansong.utils.VersionUpdatingUtils;


/**
 * 关于伞送
 */
public class AboutUsActivity extends BaseActivity implements View.OnClickListener {


    private TextView mTvVersions;
    private LinearLayout mLlNewVersion;
    private TextView mTvName;
    private LinearLayout mLlService;
    private LinearLayout mLlRealNameAuthentication;//给我们打分
    private LinearLayout mLlCertification;//平台资质
    private LinearLayout mLlMyCircle;//我的圈子
    private LinearLayout mLlAgreement;
    private final String serviceTel = "4008899050";
    private TextView mTvServiceTel;

    @Override
    public int initLayout() {
        return R.layout.activity_about_us;
    }

    @Override
    public void initView() {

        TextView mTvTitle = findViewById(R.id.tv_title);
        mTvTitle.setText("关于伞送");
        mTvVersions = findViewById(R.id.tv_versions);
        mLlNewVersion = findViewById(R.id.ll_new_version);
        mTvName = findViewById(R.id.tv_name);
        mLlService = findViewById(R.id.ll_service);
        mLlRealNameAuthentication = findViewById(R.id.ll_real_name_authentication);
        mLlCertification = findViewById(R.id.ll_certification);
        mLlAgreement = findViewById(R.id.ll_business_license);

        mLlService.setOnClickListener(this);
        mLlAgreement.setOnClickListener(this);
        mLlCertification.setOnClickListener(this);
        mLlNewVersion.setOnClickListener(this);
        mTvServiceTel = findViewById(R.id.tv_service_tel);
    }

    @Override
    public void initData() {
        mTvVersions.setText(String.format("V%s", BuildConfig.VERSION_NAME));
        mTvName.setText(String.format("V%s", BuildConfig.VERSION_NAME));
        mTvServiceTel.setText(serviceTel);
    }

    String url;

    @SuppressLint("NonConstantResourceId")
    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.ll_new_version:
                VersionUpdatingUtils.versionUpdating(mActivity, 2);
                break;
            case R.id.ll_service:
                MyUtils.callPhone(mActivity, serviceTel);
                break;
            case R.id.ll_business_license:
                url = "https://sansong20.oss-cn-shanghai.aliyuncs.com/gobalsansong/upload/other/2023/10/25/yyzz.jpg";
                startActivity(new Intent(mActivity, CheckAttachmentActivity.class).putExtra("type", 1)
                        .putExtra("attachment", url)
                        .putExtra("title", "营业执照"));
                break;
            case R.id.ll_certification:
                url = "https://sansong20.oss-cn-shanghai.aliyuncs.com/gobalsansong/upload/other/2023/10/25/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20230617123921.png";
                startActivity(new Intent(mActivity, CheckAttachmentActivity.class).putExtra("type", 1)
                        .putExtra("attachment", url)
                        .putExtra("title", "平台资质"));
                break;
        }
    }


}